<?php

    class HangveModule extends CWebModule
    {
        public function init()
        {
            // set params for module
            Yii::app()->params->mergeWith(require(dirname(__FILE__).'/config/params.php'));
            Yii::app()->params->mergeWith(require(APP_PATH.'/protected/modules/user/config/params.php'));
            
            // import the module-level models and components
            $this->setImport(array(
                'hangve.components.*',
                'hangve.models.*',
                'user.models.User',
                'user.models.UserEmail',
                'user.models.UserPhone',
                'user.models.form.LoginForm',
                'application.models.geo.Geo',
                'application.models.geo.City',
                'application.models.geo.District',
            ));



            // set components
            Yii::app()->setComponents(array(

                'errorHandler'=>array(
                    'errorAction'=>'/hangve/page/error',
                ),
                'db'=>Yii::app()->dbHangve, 
                'user' => array(
                    'class' => 'hangve.components.WebUser',
                    'allowAutoLogin'=>true,
                    'loginUrl'=>array('/user/page/login'),
                ),
                //                'messages' => array(
                //                    'class'=>'CPhpMessageSource',
                //                    'basePath'=>'protected/modules/fbuser/messages',
                //                ),
            ));
            Yii::app()->theme = 'hangve'; 
        }                    

        public function beforeControllerAction($controller, $action)
        {
            if(parent::beforeControllerAction($controller, $action))
            {
                // this method is called before any module controller action is performed
                // you may place customized code here
                return true;
            }
            else
                return false;
        }
    }
